home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / GIFLIB12.ARJ / QPRINTF.C < prev    next >
C/C++ Source or Header  |  1991-05-12  |  2KB  |  56 lines

  1. /*****************************************************************************
  2. *   "Gif-Lib" - Yet another gif library.                     *
  3. *                                         *
  4. * Written by:  Gershon Elber            IBM PC Ver 0.1,    Jun. 1989    *
  5. ******************************************************************************
  6. * Module to emulate a printf with a possible quite (disable mode.)           *
  7. * A global variable GifQuitePrint controls the printing of this routine      *
  8. ******************************************************************************
  9. * History:                                     *
  10. * 12 May 91 - Version 1.0 by Gershon Elber.                     *
  11. *****************************************************************************/
  12.  
  13. #include <stdio.h>
  14.  
  15. #ifdef USE_VARARGS
  16. #include <varargs.h>
  17. #else
  18. #include <stdarg.h>
  19. #endif /* USE_VARARGS */
  20.  
  21. #include "gif_lib.h"
  22.  
  23. #ifdef __MSDOS__
  24. int GifQuitePrint = FALSE;
  25. #else
  26. int GifQuitePrint = TRUE;
  27. #endif /* __MSDOS__ */
  28.  
  29. /*****************************************************************************
  30. * Same as fprintf to stderr but with optional print.                 *
  31. *****************************************************************************/
  32. #ifdef USE_VARARGS
  33. void GifQprintf(int va_alist)
  34. {
  35.     char *Format, Line[128];
  36.     va_list ArgPtr;
  37.  
  38.     va_start(ArgPtr);
  39.     Format = va_arg(ArgPtr, char *);
  40. #else
  41. void GifQprintf(char *Format, ...)
  42. {
  43.     char Line[128];
  44.     va_list ArgPtr;
  45.  
  46.     va_start(ArgPtr, Format);
  47. #endif /* USE_VARARGS */
  48.  
  49.     if (GifQuitePrint) return;
  50.  
  51.     vsprintf(Line, Format, ArgPtr);
  52.     va_end(ArgPtr);
  53.  
  54.     fputs(Line, stderr);
  55. }
  56.